package com.professordelphi.locadora;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import javax.swing.JFrame;
import javax.swing.JOptionPane;

public class Conexao extends JFrame{
	Connection con;
	Statement meustate;
	ResultSet rs;
	

	public Conexao() {
		try{//tratamento de erro segundo catch!
			Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
			con=DriverManager.getConnection("jdbc:odbc:odbc_locadora2_reginaldo");
			meustate=con.createStatement();
			
		}
		
		catch(SQLException ex){
			JOptionPane.showMessageDialog(null,"odbc nao encontrado");
			
		}
		catch(ClassNotFoundException ex){
			JOptionPane.showMessageDialog(null,"Classe de conexao digitada errada");
		}
		// TODO Auto-generated constructor stub
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Conexao c=new Conexao();
		c.setVisible(true);
		// TODO Auto-generated method stub

	}

}
